<?php
class Sfs_Controller_Action_Helper_GetStorePath  extends  Zend_Controller_Action_Helper_Abstract
{
    public function direct($path='')
    {
        if ($path == '') {
            $front = Zend_Controller_Front::getInstance();
            $data_path =  Bootstrap::getPath('data').'/'.$front->getRequest()->getModuleName();
            if (!is_dir($data_path))
            mkdir($data_path,0755);
        }
        else { // 自訂目錄
            $arr = explode ("/",$path);
            $temp =  Bootstrap::getPath('data').'/';
            for($i=0;$i<count($arr);$i++){
                if ($arr[$i]<>''){
                    $temp .= $arr[$i];
                    if (!is_dir($temp))
                    mkdir($temp, 0755);
                    $temp .= "/";
                }
            }
            $data_path = $temp;
        }
        return $data_path;
    }

}